package com.tangcco.lockwell;

import com.tangcco.lockwell.domain.ExamPaper;
import com.tangcco.lockwell.domain.Inform;
import com.tangcco.lockwell.domain.Message;
import com.tangcco.lockwell.domain.Question;
import com.tangcco.lockwell.repository.ExamPaperMapper;
import com.tangcco.lockwell.repository.InformMapper;
import com.tangcco.lockwell.repository.MessageMapper;
import com.tangcco.lockwell.viewmodel.admin.exam.ExamPaperEditRequestVM;
import com.tangcco.lockwell.viewmodel.admin.exam.ExamPaperPageRequestVM;
import com.tangcco.lockwell.viewmodel.admin.exam.ExamPaperTitleItemVM;
import com.tangcco.lockwell.viewmodel.student.exam.ExamPaperPageVM;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import static com.tangcco.lockwell.utility.DateToString.dateToString;

@SpringBootTest
class LockwellApplicationTests_wmz {
	@Resource
	ExamPaperMapper examPaperMapper;
	@Resource
	MessageMapper messageMapper;
	@Resource
	InformMapper informMapper;
	@Resource
	ExamPaperEditRequestVM examPaperEditRequestVM;
	@Resource
	ExamPaperTitleItemVM examPaperTitleItemVM;
	@Test
	void contextLoads() {
//		selectByPrimaryKey
		/*
		ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(1);
		System.out.println(examPaper);*/
//		insertSelective
		/*ExamPaper examPaper = new ExamPaper(null,"测试2",1,1,null,150,1,120,null,null,"qwe",1,dateToString(new Date()),0,null,null);
		examPaperMapper.insert(examPaper);*/
//		deleteByPrimaryKey
		/*examPaperMapper.deleteByPrimaryKey(1);*/
//		updateByPrimaryKeySelective
		/*ExamPaper examPaper = new ExamPaper(2,"测试222",1,1,null,150,1,120,null,null,"qwe",1,dateToString(new Date()),0,null,null);
		examPaperMapper.updateByPrimaryKeySelective(examPaper);*/
//		page
		/*ExamPaperPageRequestVM examPaperPageRequestVM = new ExamPaperPageRequestVM();
		examPaperPageRequestVM.setPaperType(1);
		examPaperPageRequestVM.setSubjectId(1);

		List<ExamPaper> page = examPaperMapper.page(examPaperPageRequestVM);
		for(ExamPaper examPaper : page){
			System.out.println(examPaper);
		}*/


		//message表
		/*
		Message message = new Message(null,1,"1",dateToString(new Date()),"1","1",1,null,1,1,dateToString(new Date()),null);
//		messageMapper.insert(message);
		messageMapper.updatelikes(1);
		*/


		//inform表
		/*
		Inform inform = new Inform(null,2,1,dateToString(new Date()),"1",0,1,dateToString(new Date()),null);
		informMapper.insert(inform);
		*/
		/*
		Inform inform2 = new Inform(2,999,111,dateToString(new Date()),"222",0,2,dateToString(new Date()),null);
		informMapper.updateByPrimaryKeySelective(inform2);*/
		/*informMapper.updateIsRead(1);*/
		/*
		Inform inform = new Inform();
		inform.setAcceptUserId(1);
		List<Inform> list = informMapper.selectSelective(inform);
		*/
//		Question question = new Question();
//		Question question1 = new Question();
//		question.setId(999);
//		question.setInfoTextContentId(1);
//		question.setScore(100);
//		question1.setId(998);
//		question1.setInfoTextContentId(2);
//		question1.setScore(100);
//		List<Question> questions = new ArrayList<>();
//		questions.add(question);
//		questions.add(question1);
//		examPaperTitleItemVM.setName("选择");
////		examPaperTitleItemVM.setQuestionItems(questions);
//		List<ExamPaperTitleItemVM> examPaperTitleItemVMs = new ArrayList<>();
//		examPaperTitleItemVMs.add(examPaperTitleItemVM);
//		examPaperEditRequestVM.setId(1);
//		examPaperEditRequestVM.setLevel(2024);
//		examPaperEditRequestVM.setSubjectId(1);
//		examPaperEditRequestVM.setPaperType(1);
//		examPaperEditRequestVM.setName("测试");
//		examPaperEditRequestVM.setSuggestTime(20);
//		examPaperEditRequestVM.setScore("100");
//
//		examPaperEditRequestVM.setTitleItems(examPaperTitleItemVMs);
	}

}
